<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script>
<script src="../js/layer/layer.js"></script>
<script type="text/javascript">
$(function () {
	$("tr:odd").css("background-color","gray");
});
//删除
$("#del").live("click", function () {
        if($("[type='checkbox']").attr("checked")){
        	var rs=window.confirm("确认删除吗？");
        	if(rs==true){
        		$("#bo").parent().parent().remove();
        	}
        }else{
        	alert("请选择车次");
        }
    })
$("#shan").live("click", function () {
	if(window.confirm("确认删除吗？")){
            $(this).parent().parent().remove();
            window.location.href="delete.jsp?id=${l.train_no }";
        }
	
    })
</script>
</head>
<body>
<c:if test="${empty list }">
		<c:redirect url="AllServlet"></c:redirect>
	</c:if>
	<c:if test="${not empty list }">
	<table border="1" cellspacing="0" cellpadding="0">
		<tr>
			<td><a id="del" href="#">删除</a></td>
			<td>车次</td>
			<td>发车--到达</td>
			<td>发时--到时</td>
			<td>车型</td>
			<td>运行时间(小时)</td>
			<td>里程(公里)</td>
		</tr>
		<c:forEach items="${list }" var="l" varStatus="abc">
		<tr>
			<td><input type="checkbox" name="checkbox" id="bo"/></td>
			<td><a href="TrainServlet?id=${l.train_no }">${l.train_no }</a></td>
			<td>${l.start_station }--${l.arrival_station}</td>
			<td>${l.start_time }--${l.arrival_time }</td>
			<td>${l.type }</td>
			<td>${l.runtime }</td>
			<td>${l.mile }</td>
			<td><a id="shan" href="DeleteServlet?id=${l.train_no }">删除</a></td>
		</tr>
		</c:forEach>
	</table>
	</c:if>
</body>
</html>